Fix --onlyfailures flag to work in non-watch mode#10678
Conversation
|
This is ready for review @SimenB . Thanks! |
be5fcc0 to
0412466
Compare
SimenB
left a comment
There was a problem hiding this comment.
Thanks! This looks really good.
The only thing I think is missing is an integration test. A test that:
- runs some tests where one fail (but one or more passes)
- runs jest again with
--onlyFailuresand verify that only one test triggered (and it failed) - make a change that fixes said test
- runs jest again with
--onlyFailurespassed - still only that test should run, but this this it should pass - run jest yet again with
--onlyFailurespassed and it should run no tests printing the warning
| // files unless `--watch` is also passed. | ||
| // or failed files unless `--watch` is also passed. | ||
| newOptions.onlyChanged = newOptions.watch; | ||
| newOptions.onlyFailures = newOptions.watch; |
There was a problem hiding this comment.
this is a change in behavior for the watch flag, but I like it
There was a problem hiding this comment.
hmm, coming back to this, I don't 😅 If I run in watch mode I want to run all tests I specify, not just the ones that failed last time (unless I opt in to this behavior)
There was a problem hiding this comment.
When I said I liked it, what I thought at the time this did was, that in addition to running the specified files, we'll run any failing tests. But that's not what this does
There was a problem hiding this comment.
There is no way to opt out of this behaviour without using the command line Press f as far as I can tell. It's broken running jest in watch mode in webstorm as you cannot interact with the CLI. This behaviour is a pain.
There was a problem hiding this comment.
@domarmstrong reverted in #10692, will make a new release once #10690 is solved
1c1d40e to
4ad6f9f
Compare
4ad6f9f to
2b3630b
Compare
|
@SimenB I've added the integration test |
SimenB
left a comment
There was a problem hiding this comment.
Thanks! This is a great contribution 👍
|
@SimenB has this been released in stable release? Cannot get it to work |
|
It was released in 26.6.1. If it doesn't work, please open up a new issue |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes #6470 .
Previously, upon passing the
--onlyFailuresflag in non-watch mode, all the tests were run instead of just the failed tests.This PR fixes the bug. Now, the
--onlyFailuresflag will work as expected in non-watch mode.